package com.itheima.service.impl;


import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.dao.Menu_managementDao;
import com.itheima.dao.User_managementDao;
import com.itheima.domain.Menu_management;
import com.itheima.domain.PageResult;
import com.itheima.domain.User_management;
import com.itheima.service.User_managementService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
@Service
public class User_managementImpl implements User_managementService {
    @Autowired
    private User_managementDao userDao;
    @Override
    public List<User_management> findAll() {
        return userDao.findAll();
    }

    @Override
    public User_management findById(Integer userId) {
        return userDao.findById(userId);
    }

    @Override
    public void updateUser(User_management user) {
        userDao.updateUser(user);
    }

    @Override
    public void save(User_management user_management) {
        userDao.save(user_management);
    }

    @Override
    //删除

    public void delete(Integer id) throws RuntimeException{
        //查询当前检查项是否和检查组关联

        userDao.deleteById(id);
    }

    @Override
    public void edit(User_management user_management) {
        userDao.edit(user_management);
    }

    public PageResult pageQuery(Integer currentPage, Integer pageSize, String queryString) {
        PageHelper.startPage(currentPage,pageSize);
        Page<User_management> page = userDao.selectByCondition(queryString);
        return new PageResult(page.getTotal(),page.getResult());
    }


    @Override
    public List<User_management> EstimateFindAll() {
        return userDao.EstimateFindAll();
    }
}
